﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace LotteryAdmin.Model
{
    class NumberRow : INotifyPropertyChanged
    {
        public int Id { get; set; }

        [DataMember(Name = "Channel")]
        public string Channel { get; set; }

        public NumberRow(int n0, int n1, int n2, int n3, int n4, int n5, string channel)
        {
            Number0 = n0;
            Number1 = n1;
            Number2 = n2;
            Number3 = n3;
            Number4 = n4;
            Number5 = n5;
            this.Channel = channel;
        }

        private int m_n0;

        [DataMember(Name = "Number0")]
        public int Number0
        {
            get { return m_n0; }
            set
            {
                if (value != m_n0)
                {
                    m_n0 = value;
                    OnPropertyChanged("Number0");
                }
            }
        }

        private int m_n1;

        [DataMember(Name = "Number1")]
        public int Number1
        {
            get { return m_n1; }
            set
            {
                if (value != m_n1)
                {
                    m_n1 = value;
                    OnPropertyChanged("Number1");
                }
            }
        }

        private int m_n2;

        [DataMember(Name = "Number2")]
        public int Number2
        {
            get { return m_n2; }
            set
            {
                if (value != m_n2)
                {
                    m_n2 = value;
                    OnPropertyChanged("Number2");
                }
            }
        }

        private int m_n3;

        [DataMember(Name = "Number3")]
        public int Number3
        {
            get { return m_n3; }
            set
            {
                if (value != m_n3)
                {
                    m_n3 = value;
                    OnPropertyChanged("Number3");
                }
            }
        }

        private int m_n4;

        [DataMember(Name = "Number4")]
        public int Number4
        {
            get { return m_n4; }
            set
            {
                if (value != m_n4)
                {
                    m_n4 = value;
                    OnPropertyChanged("Number4");
                }
            }
        }

        private int m_n5;

        [DataMember(Name = "Number5")]
        public int Number5
        {
            get { return m_n5; }
            set
            {
                if (value != m_n5)
                {
                    m_n5 = value;
                    OnPropertyChanged("Number5");
                }
            }
        }

        private void OnPropertyChanged(string name)
        {
            PropertyChangedEventHandler temp = PropertyChanged;

            if (null != temp)
            {
                temp(this, new PropertyChangedEventArgs(name));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
